# 从txt文件加载数据
with open('mem.txt', 'r') as file:
    lines = file.readlines()

output_lines = []

# 拆分每一行的数字
for line in lines:
    numbers = line.strip()
    
    # 将每行数字拆分为每行8个数字
    split_numbers = [numbers[i:i+8] for i in range(0, len(numbers), 8)]
    one   = numbers[24:32]   
    two   = numbers[16:24]   
    three = numbers[8:16]   
    four  = numbers[0:8]   
    # 将拆分后的数字重新合并为字符串
    formatted_line = '\n'.join([one,two,three,four])
    
    output_lines.append(formatted_line)

# 将拆分后的结果写入新的txt文件
with open('mem_8.txt', 'w') as file:
    file.writelines('\n'.join(output_lines))
